package com.zwh.common.utils.bean;

import java.util.Objects;

/**
 * 不同的属性
 *
 * @author zhangwenhe
 */
public class FieldInfo {
    private String fieldName;
    private Object newVal;
    private Object oldVal;

    public FieldInfo() {
    }

    public FieldInfo(String fieldName, Object newVal, Object oldVal) {
        this.fieldName = fieldName;
        this.newVal = newVal;
        this.oldVal = oldVal;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }


    public Object getNewVal() {
        return newVal;
    }

    public void setNewVal(Object newVal) {
        this.newVal = newVal;
    }

    public Object getOldVal() {
        return oldVal;
    }

    public void setOldVal(Object oldVal) {
        this.oldVal = oldVal;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        FieldInfo fieldInfo = (FieldInfo) o;
        return Objects.equals(fieldName, fieldInfo.fieldName) &&

                Objects.equals(newVal, fieldInfo.newVal) &&
                Objects.equals(oldVal, fieldInfo.oldVal);
    }

    @Override
    public int hashCode() {
        return Objects.hash(fieldName, newVal, oldVal);
    }

    @Override
    public String toString() {
        return "FieldInfo{" +
                "fieldName='" + fieldName + '\'' +
                ", firstVal=" + newVal +
                ", secondVal=" + oldVal +
                '}';
    }
}
